﻿Imports System.Windows.Forms

' Context menu to open up on right click of a file or folder in the project explorer
Public Class ProjectFileContextMenu
    Inherits ContextMenuStrip

    Public Sub New()
        Items.Add("Open Path", Nothing, AddressOf OpenPath_Clicked)
        Items.Add("Open Editor", Nothing, AddressOf OpenEditor_Clicked)
        Items.Add("-")
        Items.Add("Rename File", Nothing, AddressOf RenameFile_Clicked).Enabled = False
        Items.Add("-")
        Items.Add("Delete File", Nothing, AddressOf RemoveFile_Clicked).Enabled = False
        Items.Add("-")
        Items.Add("Properties", Nothing, AddressOf OpenProperties_Clicked)
    End Sub

    ' Project file of the clicked item (set by MainForm)
    Property ClickedProjectFile As Project.ProjectFile

    Public Sub OpenPath_Clicked(ByVal sender As Object, ByVal e As EventArgs)
        ClickedProjectFile.OpenPath()
    End Sub

    Public Sub OpenEditor_Clicked(ByVal sender As Object, ByVal e As EventArgs)
        ClickedProjectFile.OpenEditor()
    End Sub

    Public Sub RenameFile_Clicked(ByVal sender As Object, ByVal e As EventArgs)
        Throw New NotImplementedException()
    End Sub

    Public Sub RemoveFile_Clicked(ByVal sender As Object, ByVal e As EventArgs)
        Throw New NotImplementedException()
    End Sub

    Public Sub OpenProperties_Clicked(ByVal sender As Object, ByVal e As EventArgs)
        ProjectFilePropertiesForm.ClassName = ClickedProjectFile.UnrealClass.Name
        ProjectFilePropertiesForm.Text = ProjectFilePropertiesForm.ClassName
        ProjectFilePropertiesForm.ContainingFolder = ClickedProjectFile.Directory
        ProjectFilePropertiesForm.FullPath = ClickedProjectFile.FullName
        ProjectFilePropertiesForm.ProjectFile = ClickedProjectFile
        ProjectFilePropertiesForm.Show()
    End Sub

End Class
